{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "gNZMgPcMJGrE"
   },
   "source": [
    "# Analyze Hemingway's known lending library activity\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "id": "q81hUE1mUVIf"
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# add project root to path so we can import utility methods\n",
    "import sys\n",
    "sys.path.append('..')\n",
    "\n",
    "from utils.missing_data_processing import load_initial_data, preprocess_events_data\n",
    "from utils.charts import save_altair_chart, raincloud_plot\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from importlib import reload\n",
    "import utils.charts\n",
    "reload(utils.charts)\n",
    "\n",
    "from utils.charts import save_altair_chart, raincloud_plot\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Load event data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "Ybo1zEQeMynE",
    "outputId": "330b8179-c9b2-4526-f75f-8c4614e04ce2"
   },
   "outputs": [],
   "source": [
    "# for hemingway borrowing, we only need events\n",
    "events_df, _, _, _ = load_initial_data()\n",
    "# preprocess to split shared account members and generate short ids for members and items\n",
    "events_df = preprocess_events_data(events_df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "G0tISdz0n0ir"
   },
   "source": [
    "## Hemingway's borrowing\n",
    "\n",
    "Filter to borrow events for Hemingway only based on item type and Hemingway's short member id, then limit to the fields that are relevant for this analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "OFtlJm-8n4zp",
    "outputId": "d5723b49-e3a5-4c51-9f11-cd9e7f941f13"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "117"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# get hemingway's borrow events\n",
    "hemingway_borrows = events_df[(events_df.member_id == 'hemingway-ernest') & (events_df.event_type == 'Borrow')]\n",
    "len(hemingway_borrows)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>start_date</th>\n",
       "      <th>end_date</th>\n",
       "      <th>item_title</th>\n",
       "      <th>item_authors</th>\n",
       "      <th>item_year</th>\n",
       "      <th>borrow_duration_days</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>338</th>\n",
       "      <td>1927-11</td>\n",
       "      <td>1927-12-07</td>\n",
       "      <td>The Bridge of San Luis Rey</td>\n",
       "      <td>Wilder, Thornton</td>\n",
       "      <td>1927.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>551</th>\n",
       "      <td>1938-11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The Education of Hyman Kaplan</td>\n",
       "      <td>Rosten, Leo</td>\n",
       "      <td>1937.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>552</th>\n",
       "      <td>1938-12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>New Masses</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5629</th>\n",
       "      <td>1925-10-08</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Mammonart: An Essay in Economic Interpretation</td>\n",
       "      <td>Sinclair, Upton</td>\n",
       "      <td>1925.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5643</th>\n",
       "      <td>1925-10-12</td>\n",
       "      <td>1925-10-27</td>\n",
       "      <td>Sentimental Education</td>\n",
       "      <td>Flaubert, Gustave</td>\n",
       "      <td>1869.0</td>\n",
       "      <td>15.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      start_date    end_date                                      item_title  \\\n",
       "338      1927-11  1927-12-07                      The Bridge of San Luis Rey   \n",
       "551      1938-11         NaN                   The Education of Hyman Kaplan   \n",
       "552      1938-12         NaN                                      New Masses   \n",
       "5629  1925-10-08         NaN  Mammonart: An Essay in Economic Interpretation   \n",
       "5643  1925-10-12  1925-10-27                           Sentimental Education   \n",
       "\n",
       "           item_authors  item_year  borrow_duration_days  \n",
       "338    Wilder, Thornton     1927.0                   NaN  \n",
       "551         Rosten, Leo     1937.0                   NaN  \n",
       "552                 NaN        NaN                   NaN  \n",
       "5629    Sinclair, Upton     1925.0                   NaN  \n",
       "5643  Flaubert, Gustave     1869.0                  15.0  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# limit to fields we care about\n",
    "hemingway_borrows = hemingway_borrows[['start_date', 'end_date', 'item_title', 'item_authors', 'item_year', 'borrow_duration_days']]\n",
    "hemingway_borrows.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "y2w8yRaEoObh"
   },
   "source": [
    "### Distribution of borrow durations\n",
    "\n",
    "How long did Hemingway typically borrow books?\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>start_date</th>\n",
       "      <th>end_date</th>\n",
       "      <th>item_title</th>\n",
       "      <th>item_authors</th>\n",
       "      <th>item_year</th>\n",
       "      <th>borrow_duration_days</th>\n",
       "      <th>item</th>\n",
       "      <th>dates</th>\n",
       "      <th>days out</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>338</th>\n",
       "      <td>1927-11</td>\n",
       "      <td>1927-12-07</td>\n",
       "      <td>The Bridge of San Luis Rey</td>\n",
       "      <td>Wilder, Thornton</td>\n",
       "      <td>1927.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The Bridge of San Luis Rey by Thornton Wilder ...</td>\n",
       "      <td>1927-11 to 1927-12-07</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>551</th>\n",
       "      <td>1938-11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The Education of Hyman Kaplan</td>\n",
       "      <td>Rosten, Leo</td>\n",
       "      <td>1937.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The Education of Hyman Kaplan by Leo Rosten (1...</td>\n",
       "      <td>1938-11 to -</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>552</th>\n",
       "      <td>1938-12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>New Masses</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>New Masses</td>\n",
       "      <td>1938-12 to -</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5629</th>\n",
       "      <td>1925-10-08</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Mammonart: An Essay in Economic Interpretation</td>\n",
       "      <td>Sinclair, Upton</td>\n",
       "      <td>1925.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Mammonart: An Essay in Economic Interpretation...</td>\n",
       "      <td>1925-10-08 to -</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5643</th>\n",
       "      <td>1925-10-12</td>\n",
       "      <td>1925-10-27</td>\n",
       "      <td>Sentimental Education</td>\n",
       "      <td>Flaubert, Gustave</td>\n",
       "      <td>1869.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>Sentimental Education by Gustave Flaubert (1869)</td>\n",
       "      <td>1925-10-12 to 1925-10-27</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      start_date    end_date                                      item_title  \\\n",
       "338      1927-11  1927-12-07                      The Bridge of San Luis Rey   \n",
       "551      1938-11         NaN                   The Education of Hyman Kaplan   \n",
       "552      1938-12         NaN                                      New Masses   \n",
       "5629  1925-10-08         NaN  Mammonart: An Essay in Economic Interpretation   \n",
       "5643  1925-10-12  1925-10-27                           Sentimental Education   \n",
       "\n",
       "           item_authors  item_year  borrow_duration_days  \\\n",
       "338    Wilder, Thornton     1927.0                   NaN   \n",
       "551         Rosten, Leo     1937.0                   NaN   \n",
       "552                 NaN        NaN                   NaN   \n",
       "5629    Sinclair, Upton     1925.0                   NaN   \n",
       "5643  Flaubert, Gustave     1869.0                  15.0   \n",
       "\n",
       "                                                   item  \\\n",
       "338   The Bridge of San Luis Rey by Thornton Wilder ...   \n",
       "551   The Education of Hyman Kaplan by Leo Rosten (1...   \n",
       "552                                          New Masses   \n",
       "5629  Mammonart: An Essay in Economic Interpretation...   \n",
       "5643   Sentimental Education by Gustave Flaubert (1869)   \n",
       "\n",
       "                         dates days out  \n",
       "338      1927-11 to 1927-12-07        -  \n",
       "551               1938-11 to -        -  \n",
       "552               1938-12 to -        -  \n",
       "5629           1925-10-08 to -        -  \n",
       "5643  1925-10-12 to 1925-10-27       15  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# generate labels for tooltip display \n",
    "def item_label(row):\n",
    "    # label item based on title, authors, and year; author and year may not be present\n",
    "    text = row.item_title\n",
    "    if not pd.isna(row.item_authors):\n",
    "        # could be multiple authors; split them\n",
    "        authors_firstlast = []\n",
    "        for author in row.item_authors.split(';'):\n",
    "            # author names are formatted lastname, first. split and reverse for display\n",
    "            name_parts = author.split(', ', 1)\n",
    "            name_parts.reverse()\n",
    "            authors_firstlast.append(\" \".join(name_parts))\n",
    "        text = f\"{text} by {', '.join(authors_firstlast)}\"\n",
    "    if not pd.isna(row.item_year):\n",
    "        text = f\"{text} ({int(row.item_year)})\"\n",
    "    return text\n",
    "\n",
    "def borrow_label(row):\n",
    "    # generate a borrow label from start and end date; may not both be known\n",
    "    start, end = \"-\", \"-\"\n",
    "    if not pd.isna(row.start_date):\n",
    "        start = row.start_date\n",
    "    \n",
    "    if not pd.isna(row.end_date):\n",
    "        end = row.end_date\n",
    "    \n",
    "    return f\"{start} to {end}\"\n",
    "\n",
    "hemingway_borrows['item'] = hemingway_borrows.apply(item_label, axis=1)\n",
    "hemingway_borrows['dates'] = hemingway_borrows.apply(borrow_label, axis=1)\n",
    "# copy and format borrow duration days for readable version of tooltip\n",
    "hemingway_borrows[\"days out\"] = hemingway_borrows.borrow_duration_days.apply(lambda x: \"-\" if pd.isna(x) else int(x))\n",
    "hemingway_borrows.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 132
    },
    "id": "BisM61G9oKnr",
    "outputId": "fc3801e1-a471-4c9c-950c-84ab3e1080d4"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-039baf59458c44658fc65c40f9b7b7f6\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n",
       "  (function(spec, embedOpt){\n",
       "    let outputDiv = document.currentScript.previousElementSibling;\n",
       "    if (outputDiv.id !== \"altair-viz-039baf59458c44658fc65c40f9b7b7f6\") {\n",
       "      outputDiv = document.getElementById(\"altair-viz-039baf59458c44658fc65c40f9b7b7f6\");\n",
       "    }\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.17.0?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function maybeLoadScript(lib, version) {\n",
       "      var key = `${lib.replace(\"-\", \"\")}_version`;\n",
       "      return (VEGA_DEBUG[key] == version) ?\n",
       "        Promise.resolve(paths[lib]) :\n",
       "        new Promise(function(resolve, reject) {\n",
       "          var s = document.createElement('script');\n",
       "          document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "          s.async = true;\n",
       "          s.onload = () => {\n",
       "            VEGA_DEBUG[key] = version;\n",
       "            return resolve(paths[lib]);\n",
       "          };\n",
       "          s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "          s.src = paths[lib];\n",
       "        });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else {\n",
       "      maybeLoadScript(\"vega\", \"5\")\n",
       "        .then(() => maybeLoadScript(\"vega-lite\", \"4.17.0\"))\n",
       "        .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}, \"concat\": {\"spacing\": 0}}, \"vconcat\": [{\"mark\": {\"type\": \"area\", \"orient\": \"vertical\"}, \"encoding\": {\"x\": {\"axis\": {\"labels\": false, \"ticks\": false}, \"field\": \"borrow_duration_days\", \"title\": null, \"type\": \"quantitative\"}, \"y\": {\"axis\": {\"grid\": false, \"labels\": false, \"ticks\": false, \"values\": [0]}, \"field\": \"density\", \"title\": null, \"type\": \"quantitative\"}}, \"height\": 100, \"transform\": [{\"density\": \"borrow_duration_days\", \"as\": [\"borrow_duration_days\", \"density\"]}], \"width\": 800}, {\"mark\": {\"type\": \"circle\", \"size\": 30}, \"encoding\": {\"tooltip\": [{\"field\": \"item\", \"type\": \"nominal\"}, {\"field\": \"dates\", \"type\": \"nominal\"}, {\"field\": \"days out\", \"type\": \"quantitative\"}], \"x\": {\"axis\": {\"labels\": true}, \"field\": \"borrow_duration_days\", \"title\": \"Borrow duration in days\", \"type\": \"quantitative\"}, \"y\": {\"axis\": null, \"field\": \"jitter\", \"title\": null, \"type\": \"quantitative\"}}, \"height\": 120, \"transform\": [{\"calculate\": \"(random() / 200) - 0.0052\", \"as\": \"jitter\"}], \"width\": 800}], \"data\": {\"name\": \"data-62452f5e0ab8250c73feb42980b8d7b0\"}, \"title\": \"Distribution of borrow duration for Ernest Hemingway\", \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.17.0.json\", \"datasets\": {\"data-62452f5e0ab8250c73feb42980b8d7b0\": [{\"start_date\": \"1927-11\", \"end_date\": \"1927-12-07\", \"item_title\": \"The Bridge of San Luis Rey\", \"item_authors\": \"Wilder, Thornton\", \"item_year\": 1927.0, \"borrow_duration_days\": null, \"item\": \"The Bridge of San Luis Rey by Thornton Wilder (1927)\", \"dates\": \"1927-11 to 1927-12-07\", \"days out\": \"-\"}, {\"start_date\": \"1938-11\", \"end_date\": null, \"item_title\": \"The Education of Hyman Kaplan\", \"item_authors\": \"Rosten, Leo\", \"item_year\": 1937.0, \"borrow_duration_days\": null, \"item\": \"The Education of Hyman Kaplan by Leo Rosten (1937)\", \"dates\": \"1938-11 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-12\", \"end_date\": null, \"item_title\": \"New Masses\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"New Masses\", \"dates\": \"1938-12 to -\", \"days out\": \"-\"}, {\"start_date\": \"1925-10-08\", \"end_date\": null, \"item_title\": \"Mammonart: An Essay in Economic Interpretation\", \"item_authors\": \"Sinclair, Upton\", \"item_year\": 1925.0, \"borrow_duration_days\": null, \"item\": \"Mammonart: An Essay in Economic Interpretation by Upton Sinclair (1925)\", \"dates\": \"1925-10-08 to -\", \"days out\": \"-\"}, {\"start_date\": \"1925-10-12\", \"end_date\": \"1925-10-27\", \"item_title\": \"Sentimental Education\", \"item_authors\": \"Flaubert, Gustave\", \"item_year\": 1869.0, \"borrow_duration_days\": 15.0, \"item\": \"Sentimental Education by Gustave Flaubert (1869)\", \"dates\": \"1925-10-12 to 1925-10-27\", \"days out\": 15}, {\"start_date\": \"1925-10-14\", \"end_date\": \"1925-10-22\", \"item_title\": \"Sailing Alone Around the World\", \"item_authors\": \"Slocum, Joshua\", \"item_year\": 1900.0, \"borrow_duration_days\": 8.0, \"item\": \"Sailing Alone Around the World by Joshua Slocum (1900)\", \"dates\": \"1925-10-14 to 1925-10-22\", \"days out\": 8}, {\"start_date\": \"1925-10-14\", \"end_date\": \"1925-10-22\", \"item_title\": \"The Sea and the Jungle\", \"item_authors\": \"Tomlinson, H. M.\", \"item_year\": 1912.0, \"borrow_duration_days\": 8.0, \"item\": \"The Sea and the Jungle by H. M. Tomlinson (1912)\", \"dates\": \"1925-10-14 to 1925-10-22\", \"days out\": 8}, {\"start_date\": \"1925-10-22\", \"end_date\": \"1925-11-16\", \"item_title\": \"A Sportsman's Sketches\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1895.0, \"borrow_duration_days\": 25.0, \"item\": \"A Sportsman's Sketches by Ivan Turgenev (1895)\", \"dates\": \"1925-10-22 to 1925-11-16\", \"days out\": 25}, {\"start_date\": \"1925-10-22\", \"end_date\": \"1925-10-27\", \"item_title\": \"A Lear of the Steppes and Other Stories\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1898.0, \"borrow_duration_days\": 5.0, \"item\": \"A Lear of the Steppes and Other Stories by Ivan Turgenev (1898)\", \"dates\": \"1925-10-22 to 1925-10-27\", \"days out\": 5}, {\"start_date\": \"1925-10-27\", \"end_date\": \"1925-11-16\", \"item_title\": \"The Torrents of Spring\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1872.0, \"borrow_duration_days\": 20.0, \"item\": \"The Torrents of Spring by Ivan Turgenev (1872)\", \"dates\": \"1925-10-27 to 1925-11-16\", \"days out\": 20}, {\"start_date\": \"1925-11-09\", \"end_date\": \"1925-11-24\", \"item_title\": \"The Bread of Deceit\", \"item_authors\": \"Lowndes, Marie Belloc\", \"item_year\": 1925.0, \"borrow_duration_days\": 15.0, \"item\": \"The Bread of Deceit by Marie Belloc Lowndes (1925)\", \"dates\": \"1925-11-09 to 1925-11-24\", \"days out\": 15}, {\"start_date\": \"1925-11-16\", \"end_date\": \"1925-11-24\", \"item_title\": \"The Travel Diary of a Philosopher\", \"item_authors\": \"Keyserling, Hermann von\", \"item_year\": 1919.0, \"borrow_duration_days\": 8.0, \"item\": \"The Travel Diary of a Philosopher by Hermann von Keyserling (1919)\", \"dates\": \"1925-11-16 to 1925-11-24\", \"days out\": 8}, {\"start_date\": \"1925-11-23\", \"end_date\": \"1925-12-10\", \"item_title\": \"A Parody Outline of History\", \"item_authors\": \"Stewart, Donald Ogden\", \"item_year\": 1921.0, \"borrow_duration_days\": 17.0, \"item\": \"A Parody Outline of History by Donald Ogden Stewart (1921)\", \"dates\": \"1925-11-23 to 1925-12-10\", \"days out\": 17}, {\"start_date\": \"1925-11-24\", \"end_date\": \"1925-12-01\", \"item_title\": \"More Tales of the Uneasy\", \"item_authors\": \"Hunt, Violet\", \"item_year\": 1925.0, \"borrow_duration_days\": 7.0, \"item\": \"More Tales of the Uneasy by Violet Hunt (1925)\", \"dates\": \"1925-11-24 to 1925-12-01\", \"days out\": 7}, {\"start_date\": \"1925-11-28\", \"end_date\": \"1925-12-01\", \"item_title\": \"The Terrible Hobby of Sir Joseph Londe\", \"item_authors\": \"Oppenheim, E. Phillips\", \"item_year\": 1924.0, \"borrow_duration_days\": 3.0, \"item\": \"The Terrible Hobby of Sir Joseph Londe by E. Phillips Oppenheim (1924)\", \"dates\": \"1925-11-28 to 1925-12-01\", \"days out\": 3}, {\"start_date\": \"1925-12-01\", \"end_date\": \"1925-12-10\", \"item_title\": \"The Charterhouse of Parma\", \"item_authors\": \"Stendhal\", \"item_year\": 1839.0, \"borrow_duration_days\": 9.0, \"item\": \"The Charterhouse of Parma by Stendhal (1839)\", \"dates\": \"1925-12-01 to 1925-12-10\", \"days out\": 9}, {\"start_date\": \"1925-12-10\", \"end_date\": \"1926-04-13\", \"item_title\": \"Children of the Age\", \"item_authors\": \"Hamsun, Knut\", \"item_year\": 1924.0, \"borrow_duration_days\": 124.0, \"item\": \"Children of the Age by Knut Hamsun (1924)\", \"dates\": \"1925-12-10 to 1926-04-13\", \"days out\": 124}, {\"start_date\": \"1925-12-10\", \"end_date\": \"1926-01-19\", \"item_title\": \"Fathers and Children\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1895.0, \"borrow_duration_days\": 40.0, \"item\": \"Fathers and Children by Ivan Turgenev (1895)\", \"dates\": \"1925-12-10 to 1926-01-19\", \"days out\": 40}, {\"start_date\": \"1925-12-10\", \"end_date\": \"1926-02-02\", \"item_title\": \"A House of Gentlefolk: A Novel\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1894.0, \"borrow_duration_days\": 54.0, \"item\": \"A House of Gentlefolk: A Novel by Ivan Turgenev (1894)\", \"dates\": \"1925-12-10 to 1926-02-02\", \"days out\": 54}, {\"start_date\": \"1925-12-10\", \"end_date\": \"1926-01-19\", \"item_title\": \"Buddenbrooks\", \"item_authors\": \"Mann, Thomas\", \"item_year\": 1924.0, \"borrow_duration_days\": 40.0, \"item\": \"Buddenbrooks by Thomas Mann (1924)\", \"dates\": \"1925-12-10 to 1926-01-19\", \"days out\": 40}, {\"start_date\": \"1926-01-28\", \"end_date\": \"1926-02-02\", \"item_title\": \"The Doctor Looks at Literature: Psychological Studies of Life and Letters\", \"item_authors\": \"Collins, Joseph\", \"item_year\": 1923.0, \"borrow_duration_days\": 5.0, \"item\": \"The Doctor Looks at Literature: Psychological Studies of Life and Letters by Joseph Collins (1923)\", \"dates\": \"1926-01-28 to 1926-02-02\", \"days out\": 5}, {\"start_date\": \"1926-01-30\", \"end_date\": \"1926-01-30\", \"item_title\": \"Bull Fighting\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Bull Fighting\", \"dates\": \"1926-01-30 to 1926-01-30\", \"days out\": \"-\"}, {\"start_date\": \"1926-03-29\", \"end_date\": \"1926-05-10\", \"item_title\": \"The Best Short Stories of 1925: And the Yearbook of the American Short Story\", \"item_authors\": null, \"item_year\": 1926.0, \"borrow_duration_days\": 42.0, \"item\": \"The Best Short Stories of 1925: And the Yearbook of the American Short Story (1926)\", \"dates\": \"1926-03-29 to 1926-05-10\", \"days out\": 42}, {\"start_date\": \"1926-04-01\", \"end_date\": \"1926-04-13\", \"item_title\": \"The Flurried Years\", \"item_authors\": \"Hunt, Violet\", \"item_year\": 1926.0, \"borrow_duration_days\": 12.0, \"item\": \"The Flurried Years by Violet Hunt (1926)\", \"dates\": \"1926-04-01 to 1926-04-13\", \"days out\": 12}, {\"start_date\": \"1926-04-11\", \"end_date\": \"1926-04-24\", \"item_title\": \"Along the Road: Notes and Essays of a Tourist\", \"item_authors\": \"Huxley, Aldous\", \"item_year\": 1925.0, \"borrow_duration_days\": 13.0, \"item\": \"Along the Road: Notes and Essays of a Tourist by Aldous Huxley (1925)\", \"dates\": \"1926-04-11 to 1926-04-24\", \"days out\": 13}, {\"start_date\": \"1926-04-13\", \"end_date\": \"1926-04-24\", \"item_title\": \"Strait Is the Gate\", \"item_authors\": \"Gide, Andr\\u00e9\", \"item_year\": 1924.0, \"borrow_duration_days\": 11.0, \"item\": \"Strait Is the Gate by Andr\\u00e9 Gide (1924)\", \"dates\": \"1926-04-13 to 1926-04-24\", \"days out\": 11}, {\"start_date\": \"1926-04-17\", \"end_date\": \"1926-04-24\", \"item_title\": \"Selected Poems of Carl Sandburg\", \"item_authors\": \"Sandburg, Carl\", \"item_year\": 1926.0, \"borrow_duration_days\": 7.0, \"item\": \"Selected Poems of Carl Sandburg by Carl Sandburg (1926)\", \"dates\": \"1926-04-17 to 1926-04-24\", \"days out\": 7}, {\"start_date\": \"1926-04-21\", \"end_date\": null, \"item_title\": \"The Crime at Vanderlynden's\", \"item_authors\": \"Mottram, R. H.\", \"item_year\": 1926.0, \"borrow_duration_days\": null, \"item\": \"The Crime at Vanderlynden's by R. H. Mottram (1926)\", \"dates\": \"1926-04-21 to -\", \"days out\": \"-\"}, {\"start_date\": \"1926-04-26\", \"end_date\": null, \"item_title\": \"Early Poems and Stories\", \"item_authors\": \"Yeats, William Butler\", \"item_year\": 1925.0, \"borrow_duration_days\": null, \"item\": \"Early Poems and Stories by William Butler Yeats (1925)\", \"dates\": \"1926-04-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1926-04-29\", \"end_date\": null, \"item_title\": \"An Outcast of the Islands\", \"item_authors\": \"Conrad, Joseph\", \"item_year\": 1896.0, \"borrow_duration_days\": null, \"item\": \"An Outcast of the Islands by Joseph Conrad (1896)\", \"dates\": \"1926-04-29 to -\", \"days out\": \"-\"}, {\"start_date\": \"1926-05-04\", \"end_date\": \"1926-10-01\", \"item_title\": \"Far Away and Long Ago\", \"item_authors\": \"Hudson, W. H.\", \"item_year\": 1918.0, \"borrow_duration_days\": 150.0, \"item\": \"Far Away and Long Ago by W. H. Hudson (1918)\", \"dates\": \"1926-05-04 to 1926-10-01\", \"days out\": 150}, {\"start_date\": \"1926-05-04\", \"end_date\": \"1926-05-10\", \"item_title\": \"Steeplejack\", \"item_authors\": \"Huneker, James\", \"item_year\": 1920.0, \"borrow_duration_days\": 6.0, \"item\": \"Steeplejack by James Huneker (1920)\", \"dates\": \"1926-05-04 to 1926-05-10\", \"days out\": 6}, {\"start_date\": \"1926-05-04\", \"end_date\": \"1926-05-10\", \"item_title\": \"Egoists, a Book of Supermen: Stendhal, Baudelaire, Flaubert, Anatole France, Huysmans, Barr\\u00e8s, Nietzsche, Blake, Ibsen, Stirner, and Ernest Hello\", \"item_authors\": \"Huneker, James\", \"item_year\": 1909.0, \"borrow_duration_days\": 6.0, \"item\": \"Egoists, a Book of Supermen: Stendhal, Baudelaire, Flaubert, Anatole France, Huysmans, Barr\\u00e8s, Nietzsche, Blake, Ibsen, Stirner, and Ernest Hello by James Huneker (1909)\", \"dates\": \"1926-05-04 to 1926-05-10\", \"days out\": 6}, {\"start_date\": \"1926-05-05\", \"end_date\": \"1926-09-13\", \"item_title\": \"Thus Spake Zarathustra: A Book for All and None\", \"item_authors\": \"Nietzsche, Friedrich\", \"item_year\": 1883.0, \"borrow_duration_days\": 131.0, \"item\": \"Thus Spake Zarathustra: A Book for All and None by Friedrich Nietzsche (1883)\", \"dates\": \"1926-05-05 to 1926-09-13\", \"days out\": 131}, {\"start_date\": \"1926-05-10\", \"end_date\": \"1926-09-10\", \"item_title\": \"The Two Friends and Other Stories\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1921.0, \"borrow_duration_days\": 123.0, \"item\": \"The Two Friends and Other Stories by Ivan Turgenev (1921)\", \"dates\": \"1926-05-10 to 1926-09-10\", \"days out\": 123}, {\"start_date\": \"1926-05-10\", \"end_date\": \"1926-11-02\", \"item_title\": \"Knock Knock Knock and Other Stories\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1922.0, \"borrow_duration_days\": 176.0, \"item\": \"Knock Knock Knock and Other Stories by Ivan Turgenev (1922)\", \"dates\": \"1926-05-10 to 1926-11-02\", \"days out\": 176}, {\"start_date\": \"1926-05-10\", \"end_date\": \"1926-09-10\", \"item_title\": \"On the Eve\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1895.0, \"borrow_duration_days\": 123.0, \"item\": \"On the Eve by Ivan Turgenev (1895)\", \"dates\": \"1926-05-10 to 1926-09-10\", \"days out\": 123}, {\"start_date\": \"1926-05-14\", \"end_date\": \"1926-09-13\", \"item_title\": \"The Problems of Philosophy\", \"item_authors\": \"Russell, Bertrand\", \"item_year\": 1912.0, \"borrow_duration_days\": 122.0, \"item\": \"The Problems of Philosophy by Bertrand Russell (1912)\", \"dates\": \"1926-05-14 to 1926-09-13\", \"days out\": 122}, {\"start_date\": \"1926-08-26\", \"end_date\": \"1926-09-10\", \"item_title\": \"A Mirror to France\", \"item_authors\": \"Ford, Ford Madox\", \"item_year\": 1926.0, \"borrow_duration_days\": 15.0, \"item\": \"A Mirror to France by Ford Madox Ford (1926)\", \"dates\": \"1926-08-26 to 1926-09-10\", \"days out\": 15}, {\"start_date\": \"1926-09-10\", \"end_date\": \"1926-10-01\", \"item_title\": \"Paul C\\u00e9zanne\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": 21.0, \"item\": \"Paul C\\u00e9zanne\", \"dates\": \"1926-09-10 to 1926-10-01\", \"days out\": 21}, {\"start_date\": \"1926-09-10\", \"end_date\": \"1926-10-01\", \"item_title\": \"A Sportsman's Sketches\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1895.0, \"borrow_duration_days\": 21.0, \"item\": \"A Sportsman's Sketches by Ivan Turgenev (1895)\", \"dates\": \"1926-09-10 to 1926-10-01\", \"days out\": 21}, {\"start_date\": \"1926-09-25\", \"end_date\": \"1926-10-01\", \"item_title\": \"The New Republic\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": 6.0, \"item\": \"The New Republic\", \"dates\": \"1926-09-25 to 1926-10-01\", \"days out\": 6}, {\"start_date\": \"1926-10-01\", \"end_date\": \"1926-10-11\", \"item_title\": \"Mastro-don Gesualdo\", \"item_authors\": \"Verga, Giovanni\", \"item_year\": 1923.0, \"borrow_duration_days\": 10.0, \"item\": \"Mastro-don Gesualdo by Giovanni Verga (1923)\", \"dates\": \"1926-10-01 to 1926-10-11\", \"days out\": 10}, {\"start_date\": \"1926-10-11\", \"end_date\": null, \"item_title\": \"The Life, Work, and Evil Fate of Guy de Maupassant\", \"item_authors\": \"Sherard, Robert Harborough\", \"item_year\": 1926.0, \"borrow_duration_days\": null, \"item\": \"The Life, Work, and Evil Fate of Guy de Maupassant by Robert Harborough Sherard (1926)\", \"dates\": \"1926-10-11 to -\", \"days out\": \"-\"}, {\"start_date\": \"1926-10-11\", \"end_date\": null, \"item_title\": \"Americana\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Americana\", \"dates\": \"1926-10-11 to -\", \"days out\": \"-\"}, {\"start_date\": \"1926-10-29\", \"end_date\": \"1927-02-28\", \"item_title\": \"On the Trail of Ancient Man\", \"item_authors\": \"Andrews, Roy Chapman\", \"item_year\": 1926.0, \"borrow_duration_days\": 122.0, \"item\": \"On the Trail of Ancient Man by Roy Chapman Andrews (1926)\", \"dates\": \"1926-10-29 to 1927-02-28\", \"days out\": 122}, {\"start_date\": \"1926-11-04\", \"end_date\": \"1927-02-28\", \"item_title\": \"Composition as Explanation\", \"item_authors\": \"Stein, Gertrude\", \"item_year\": 1926.0, \"borrow_duration_days\": 116.0, \"item\": \"Composition as Explanation by Gertrude Stein (1926)\", \"dates\": \"1926-11-04 to 1927-02-28\", \"days out\": 116}, {\"start_date\": \"1926-11-18\", \"end_date\": null, \"item_title\": \"The Sailor's Return\", \"item_authors\": \"Garnett, David\", \"item_year\": 1925.0, \"borrow_duration_days\": null, \"item\": \"The Sailor's Return by David Garnett (1925)\", \"dates\": \"1926-11-18 to -\", \"days out\": \"-\"}, {\"start_date\": \"1926-12-16\", \"end_date\": \"1927-03-12\", \"item_title\": \"The Spanish Journey\", \"item_authors\": \"Meier-Graefe, Julius\", \"item_year\": 1926.0, \"borrow_duration_days\": 86.0, \"item\": \"The Spanish Journey by Julius Meier-Graefe (1926)\", \"dates\": \"1926-12-16 to 1927-03-12\", \"days out\": 86}, {\"start_date\": \"1927-03-01\", \"end_date\": \"1927-03-12\", \"item_title\": \"Go She Must!\", \"item_authors\": \"Garnett, David\", \"item_year\": 1927.0, \"borrow_duration_days\": 11.0, \"item\": \"Go She Must! by David Garnett (1927)\", \"dates\": \"1927-03-01 to 1927-03-12\", \"days out\": 11}, {\"start_date\": \"1927-04-23\", \"end_date\": null, \"item_title\": \"The Inquisition from Its Establishment to the Great Schism\", \"item_authors\": \"Maycock, A. L.\", \"item_year\": 1927.0, \"borrow_duration_days\": null, \"item\": \"The Inquisition from Its Establishment to the Great Schism by A. L. Maycock (1927)\", \"dates\": \"1927-04-23 to -\", \"days out\": \"-\"}, {\"start_date\": \"1927-05-31\", \"end_date\": null, \"item_title\": \"Parnell\", \"item_authors\": \"Ervine, St. John G.\", \"item_year\": 1925.0, \"borrow_duration_days\": null, \"item\": \"Parnell by St. John G. Ervine (1925)\", \"dates\": \"1927-05-31 to -\", \"days out\": \"-\"}, {\"start_date\": \"1927-06-11\", \"end_date\": \"1927-06-13\", \"item_title\": \"The Story of a Wonder Man: Being the Autobiography of Ring Lardner\", \"item_authors\": \"Lardner, Ring\", \"item_year\": 1927.0, \"borrow_duration_days\": 2.0, \"item\": \"The Story of a Wonder Man: Being the Autobiography of Ring Lardner by Ring Lardner (1927)\", \"dates\": \"1927-06-11 to 1927-06-13\", \"days out\": 2}, {\"start_date\": \"1927-06-11\", \"end_date\": null, \"item_title\": \"transition\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"transition\", \"dates\": \"1927-06-11 to -\", \"days out\": \"-\"}, {\"start_date\": \"1927-09-20\", \"end_date\": \"1927-10-18\", \"item_title\": \"The Grandmothers: A Family Portrait\", \"item_authors\": \"Wescott, Glenway\", \"item_year\": 1927.0, \"borrow_duration_days\": 28.0, \"item\": \"The Grandmothers: A Family Portrait by Glenway Wescott (1927)\", \"dates\": \"1927-09-20 to 1927-10-18\", \"days out\": 28}, {\"start_date\": \"1927-10-18\", \"end_date\": \"1927-10-19\", \"item_title\": \"Time and Western Man\", \"item_authors\": \"Lewis, Wyndham\", \"item_year\": 1927.0, \"borrow_duration_days\": 1.0, \"item\": \"Time and Western Man by Wyndham Lewis (1927)\", \"dates\": \"1927-10-18 to 1927-10-19\", \"days out\": 1}, {\"start_date\": \"1927-10-19\", \"end_date\": \"1927-10-25\", \"item_title\": \"The Black Cap: New Stories of Murder and Mystery\", \"item_authors\": null, \"item_year\": 1927.0, \"borrow_duration_days\": 6.0, \"item\": \"The Black Cap: New Stories of Murder and Mystery (1927)\", \"dates\": \"1927-10-19 to 1927-10-25\", \"days out\": 6}, {\"start_date\": \"1927-10-25\", \"end_date\": \"1927-11-15\", \"item_title\": \"Barnum's Own Story\", \"item_authors\": \"Barnum, P. T.\", \"item_year\": 1927.0, \"borrow_duration_days\": 21.0, \"item\": \"Barnum's Own Story by P. T. Barnum (1927)\", \"dates\": \"1927-10-25 to 1927-11-15\", \"days out\": 21}, {\"start_date\": \"1927-10-25\", \"end_date\": \"1927-11-15\", \"item_title\": \"Mother India\", \"item_authors\": \"Mayo, Katherine\", \"item_year\": 1927.0, \"borrow_duration_days\": 21.0, \"item\": \"Mother India by Katherine Mayo (1927)\", \"dates\": \"1927-10-25 to 1927-11-15\", \"days out\": 21}, {\"start_date\": \"1927-11-14\", \"end_date\": \"1927-12-07\", \"item_title\": \"The Dial\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": 23.0, \"item\": \"The Dial\", \"dates\": \"1927-11-14 to 1927-12-07\", \"days out\": 23}, {\"start_date\": \"1927-11-14\", \"end_date\": \"1927-11-26\", \"item_title\": \"The Story of Ivy\", \"item_authors\": \"Lowndes, Marie Belloc\", \"item_year\": 1927.0, \"borrow_duration_days\": 12.0, \"item\": \"The Story of Ivy by Marie Belloc Lowndes (1927)\", \"dates\": \"1927-11-14 to 1927-11-26\", \"days out\": 12}, {\"start_date\": \"1927-11-23\", \"end_date\": \"1927-12-07\", \"item_title\": \"Shadow River\", \"item_authors\": \"Smith, Walton Hall\", \"item_year\": 1927.0, \"borrow_duration_days\": 14.0, \"item\": \"Shadow River by Walton Hall Smith (1927)\", \"dates\": \"1927-11-23 to 1927-12-07\", \"days out\": 14}, {\"start_date\": \"1927-11-26\", \"end_date\": \"1927-12-07\", \"item_title\": \"Before the Bombardment\", \"item_authors\": \"Sitwell, Osbert\", \"item_year\": 1926.0, \"borrow_duration_days\": 11.0, \"item\": \"Before the Bombardment by Osbert Sitwell (1926)\", \"dates\": \"1927-11-26 to 1927-12-07\", \"days out\": 11}, {\"start_date\": \"1927-12-07\", \"end_date\": \"1928-02-06\", \"item_title\": \"Gallions Reach\", \"item_authors\": \"Tomlinson, H. M.\", \"item_year\": 1927.0, \"borrow_duration_days\": 61.0, \"item\": \"Gallions Reach by H. M. Tomlinson (1927)\", \"dates\": \"1927-12-07 to 1928-02-06\", \"days out\": 61}, {\"start_date\": \"1927-12-07\", \"end_date\": \"1928-02-13\", \"item_title\": \"The Gambler\", \"item_authors\": \"Dostoyevsky, Fyodor\", \"item_year\": 1866.0, \"borrow_duration_days\": 68.0, \"item\": \"The Gambler by Fyodor Dostoyevsky (1866)\", \"dates\": \"1927-12-07 to 1928-02-13\", \"days out\": 68}, {\"start_date\": \"1927-12-07\", \"end_date\": \"1928-02-13\", \"item_title\": \"The Insulted and Injured\", \"item_authors\": \"Dostoyevsky, Fyodor\", \"item_year\": 1915.0, \"borrow_duration_days\": 68.0, \"item\": \"The Insulted and Injured by Fyodor Dostoyevsky (1915)\", \"dates\": \"1927-12-07 to 1928-02-13\", \"days out\": 68}, {\"start_date\": \"1928-02-04\", \"end_date\": \"1928-02-24\", \"item_title\": \"Lawrence and the Arabs\", \"item_authors\": \"Graves, Robert\", \"item_year\": 1927.0, \"borrow_duration_days\": 20.0, \"item\": \"Lawrence and the Arabs by Robert Graves (1927)\", \"dates\": \"1928-02-04 to 1928-02-24\", \"days out\": 20}, {\"start_date\": \"1928-02-09\", \"end_date\": \"1928-03-03\", \"item_title\": \"The Torrents of Spring\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1872.0, \"borrow_duration_days\": 23.0, \"item\": \"The Torrents of Spring by Ivan Turgenev (1872)\", \"dates\": \"1928-02-09 to 1928-03-03\", \"days out\": 23}, {\"start_date\": \"1928-02-11\", \"end_date\": \"1928-03-03\", \"item_title\": \"Recollections of the Irish War\", \"item_authors\": \"Figgis, Darrell\", \"item_year\": 1927.0, \"borrow_duration_days\": 21.0, \"item\": \"Recollections of the Irish War by Darrell Figgis (1927)\", \"dates\": \"1928-02-11 to 1928-03-03\", \"days out\": 21}, {\"start_date\": \"1928-02-11\", \"end_date\": \"1928-02-13\", \"item_title\": \"The Riddle of the Irish\", \"item_authors\": \"Molony, J. Chartres\", \"item_year\": 1927.0, \"borrow_duration_days\": 2.0, \"item\": \"The Riddle of the Irish by J. Chartres Molony (1927)\", \"dates\": \"1928-02-11 to 1928-02-13\", \"days out\": 2}, {\"start_date\": \"1928-02-13\", \"end_date\": \"1928-02-28\", \"item_title\": \"The World's Illusion\", \"item_authors\": \"Wassermann, Jakob\", \"item_year\": 1920.0, \"borrow_duration_days\": 15.0, \"item\": \"The World's Illusion by Jakob Wassermann (1920)\", \"dates\": \"1928-02-13 to 1928-02-28\", \"days out\": 15}, {\"start_date\": \"1928-02-24\", \"end_date\": \"1928-03-03\", \"item_title\": \"The Emperor Jones\", \"item_authors\": \"O'Neill, Eugene\", \"item_year\": 1921.0, \"borrow_duration_days\": 8.0, \"item\": \"The Emperor Jones by Eugene O'Neill (1921)\", \"dates\": \"1928-02-24 to 1928-03-03\", \"days out\": 8}, {\"start_date\": \"1928-02-24\", \"end_date\": \"1928-03-03\", \"item_title\": \"The Plough and the Stars\", \"item_authors\": \"O'Casey, Sean\", \"item_year\": 1926.0, \"borrow_duration_days\": 8.0, \"item\": \"The Plough and the Stars by Sean O'Casey (1926)\", \"dates\": \"1928-02-24 to 1928-03-03\", \"days out\": 8}, {\"start_date\": \"1928-02-28\", \"end_date\": null, \"item_title\": \"The Magic Mountain\", \"item_authors\": \"Mann, Thomas\", \"item_year\": 1927.0, \"borrow_duration_days\": null, \"item\": \"The Magic Mountain by Thomas Mann (1927)\", \"dates\": \"1928-02-28 to -\", \"days out\": \"-\"}, {\"start_date\": \"1928-03-03\", \"end_date\": \"1928-03-08\", \"item_title\": \"The Wonder Book of the Wild: The Romance of Exploration and Big Game Stalking\", \"item_authors\": \"Golding, Harry\", \"item_year\": 1924.0, \"borrow_duration_days\": 5.0, \"item\": \"The Wonder Book of the Wild: The Romance of Exploration and Big Game Stalking by Harry Golding (1924)\", \"dates\": \"1928-03-03 to 1928-03-08\", \"days out\": 5}, {\"start_date\": \"1928-03-08\", \"end_date\": null, \"item_title\": \"Genius and Character\", \"item_authors\": \"Ludwig, Emil\", \"item_year\": 1927.0, \"borrow_duration_days\": null, \"item\": \"Genius and Character by Emil Ludwig (1927)\", \"dates\": \"1928-03-08 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-04-23\", \"end_date\": null, \"item_title\": \"The Dial\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"The Dial\", \"dates\": \"1929-04-23 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-04-23\", \"end_date\": \"1929-05-16\", \"item_title\": \"The Autobiography of Lord Alfred Douglas\", \"item_authors\": \"Douglas, Alfred\", \"item_year\": 1929.0, \"borrow_duration_days\": 23.0, \"item\": \"The Autobiography of Lord Alfred Douglas by Alfred Douglas (1929)\", \"dates\": \"1929-04-23 to 1929-05-16\", \"days out\": 23}, {\"start_date\": \"1929-04-23\", \"end_date\": \"1929-05-14\", \"item_title\": \"Zola and His Time\", \"item_authors\": \"Josephson, Matthew\", \"item_year\": 1928.0, \"borrow_duration_days\": 21.0, \"item\": \"Zola and His Time by Matthew Josephson (1928)\", \"dates\": \"1929-04-23 to 1929-05-14\", \"days out\": 21}, {\"start_date\": \"1929-04-26\", \"end_date\": null, \"item_title\": \"The Dial\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"The Dial\", \"dates\": \"1929-04-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-04-26\", \"end_date\": \"1929-05-14\", \"item_title\": \"The Guillotine and Its Servants\", \"item_authors\": \"Lenotre, G.\", \"item_year\": 1929.0, \"borrow_duration_days\": 18.0, \"item\": \"The Guillotine and Its Servants by G. Lenotre (1929)\", \"dates\": \"1929-04-26 to 1929-05-14\", \"days out\": 18}, {\"start_date\": \"1929-05-16\", \"end_date\": null, \"item_title\": \"Life in the Middle Ages\", \"item_authors\": null, \"item_year\": 1928.0, \"borrow_duration_days\": null, \"item\": \"Life in the Middle Ages (1928)\", \"dates\": \"1929-05-16 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-05-21\", \"end_date\": \"1929-07-02\", \"item_title\": \"Dostoevsky Portrayed by His Wife: The Diary and Reminiscences of Mme Dostoevsky\", \"item_authors\": \"Dostoevskaia, Anna\", \"item_year\": 1926.0, \"borrow_duration_days\": 42.0, \"item\": \"Dostoevsky Portrayed by His Wife: The Diary and Reminiscences of Mme Dostoevsky by Anna Dostoevskaia (1926)\", \"dates\": \"1929-05-21 to 1929-07-02\", \"days out\": 42}, {\"start_date\": \"1929-06-03\", \"end_date\": \"1929-06-05\", \"item_title\": \"A Bookman's Daybook\", \"item_authors\": \"Rascoe, Burton\", \"item_year\": 1929.0, \"borrow_duration_days\": 2.0, \"item\": \"A Bookman's Daybook by Burton Rascoe (1929)\", \"dates\": \"1929-06-03 to 1929-06-05\", \"days out\": 2}, {\"start_date\": \"1929-06-05\", \"end_date\": \"1929-06-21\", \"item_title\": \"Three Lives\", \"item_authors\": \"Stein, Gertrude\", \"item_year\": 1909.0, \"borrow_duration_days\": 16.0, \"item\": \"Three Lives by Gertrude Stein (1909)\", \"dates\": \"1929-06-05 to 1929-06-21\", \"days out\": 16}, {\"start_date\": \"1929-06-21\", \"end_date\": \"1929-06-24\", \"item_title\": \"Contemporary Russian Literature: 1881 \\u2013 1925\", \"item_authors\": \"Mirsky, D. S.\", \"item_year\": 1926.0, \"borrow_duration_days\": 3.0, \"item\": \"Contemporary Russian Literature: 1881 \\u2013 1925 by D. S. Mirsky (1926)\", \"dates\": \"1929-06-21 to 1929-06-24\", \"days out\": 3}, {\"start_date\": \"1929-06-24\", \"end_date\": null, \"item_title\": \"Round the Green Cloth\", \"item_authors\": \"Chester, Samuel Beach\", \"item_year\": 1928.0, \"borrow_duration_days\": null, \"item\": \"Round the Green Cloth by Samuel Beach Chester (1928)\", \"dates\": \"1929-06-24 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-06-29\", \"end_date\": \"1929-07-02\", \"item_title\": \"Politicians and the War, 1914 \\u2013 1916\", \"item_authors\": \"Beaverbrook, Max Aitken\", \"item_year\": 1928.0, \"borrow_duration_days\": 3.0, \"item\": \"Politicians and the War, 1914 \\u2013 1916 by Max Aitken Beaverbrook (1928)\", \"dates\": \"1929-06-29 to 1929-07-02\", \"days out\": 3}, {\"start_date\": \"1929-09-19\", \"end_date\": \"1929-09-27\", \"item_title\": \"This Quarter\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": 8.0, \"item\": \"This Quarter\", \"dates\": \"1929-09-19 to 1929-09-27\", \"days out\": 8}, {\"start_date\": \"1929-09-19\", \"end_date\": null, \"item_title\": \"War\", \"item_authors\": \"Renn, Ludwig\", \"item_year\": 1929.0, \"borrow_duration_days\": null, \"item\": \"War by Ludwig Renn (1929)\", \"dates\": \"1929-09-19 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-09-19\", \"end_date\": \"1929-09-27\", \"item_title\": \"Lady Chatterley's Lover\", \"item_authors\": \"Lawrence, D. H.\", \"item_year\": 1928.0, \"borrow_duration_days\": 8.0, \"item\": \"Lady Chatterley's Lover by D. H. Lawrence (1928)\", \"dates\": \"1929-09-19 to 1929-09-27\", \"days out\": 8}, {\"start_date\": \"1929-09-25\", \"end_date\": \"1929-10-19\", \"item_title\": \"Adventures of Sir Walter Raleigh\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": 24.0, \"item\": \"Adventures of Sir Walter Raleigh\", \"dates\": \"1929-09-25 to 1929-10-19\", \"days out\": 24}, {\"start_date\": \"1929-09-27\", \"end_date\": \"1930-01-23\", \"item_title\": \"The Idiot\", \"item_authors\": \"Dostoyevsky, Fyodor\", \"item_year\": 1874.0, \"borrow_duration_days\": 118.0, \"item\": \"The Idiot by Fyodor Dostoyevsky (1874)\", \"dates\": \"1929-09-27 to 1930-01-23\", \"days out\": 118}, {\"start_date\": \"1929-09-27\", \"end_date\": null, \"item_title\": \"On the Eve\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1895.0, \"borrow_duration_days\": null, \"item\": \"On the Eve by Ivan Turgenev (1895)\", \"dates\": \"1929-09-27 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-09-27\", \"end_date\": null, \"item_title\": \"A Sportsman's Sketches\", \"item_authors\": \"Turgenev, Ivan\", \"item_year\": 1895.0, \"borrow_duration_days\": null, \"item\": \"A Sportsman's Sketches by Ivan Turgenev (1895)\", \"dates\": \"1929-09-27 to -\", \"days out\": \"-\"}, {\"start_date\": \"1929-10-11\", \"end_date\": \"1929-10-19\", \"item_title\": \"Balzac in Slippers\", \"item_authors\": \"Gozlan, L\\u00e9on\", \"item_year\": 1929.0, \"borrow_duration_days\": 8.0, \"item\": \"Balzac in Slippers by L\\u00e9on Gozlan (1929)\", \"dates\": \"1929-10-11 to 1929-10-19\", \"days out\": 8}, {\"start_date\": \"1931-09-07\", \"end_date\": \"1931-09-23\", \"item_title\": \"The Virgin and the Gipsy\", \"item_authors\": \"Lawrence, D. H.\", \"item_year\": 1930.0, \"borrow_duration_days\": 16.0, \"item\": \"The Virgin and the Gipsy by D. H. Lawrence (1930)\", \"dates\": \"1931-09-07 to 1931-09-23\", \"days out\": 16}, {\"start_date\": \"1931-09-07\", \"end_date\": \"1931-09-23\", \"item_title\": \"Pagany: A Native Quarterly\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": 16.0, \"item\": \"Pagany: A Native Quarterly\", \"dates\": \"1931-09-07 to 1931-09-23\", \"days out\": 16}, {\"start_date\": \"1933-11-10\", \"end_date\": \"1933-11-21\", \"item_title\": \"Discursions on Travel Art and Life\", \"item_authors\": \"Sitwell, Osbert\", \"item_year\": 1925.0, \"borrow_duration_days\": 11.0, \"item\": \"Discursions on Travel Art and Life by Osbert Sitwell (1925)\", \"dates\": \"1933-11-10 to 1933-11-21\", \"days out\": 11}, {\"start_date\": \"1933-11-10\", \"end_date\": \"1933-11-21\", \"item_title\": \"Sober Truth: A Collection of Nineteenth-Century Episodes, Fantastic, Grotesque and Mysterious\", \"item_authors\": null, \"item_year\": 1930.0, \"borrow_duration_days\": 11.0, \"item\": \"Sober Truth: A Collection of Nineteenth-Century Episodes, Fantastic, Grotesque and Mysterious (1930)\", \"dates\": \"1933-11-10 to 1933-11-21\", \"days out\": 11}, {\"start_date\": \"1933-11-10\", \"end_date\": \"1933-11-21\", \"item_title\": \"The Men of Ness\", \"item_authors\": \"Linklater, Eric\", \"item_year\": 1932.0, \"borrow_duration_days\": 11.0, \"item\": \"The Men of Ness by Eric Linklater (1932)\", \"dates\": \"1933-11-10 to 1933-11-21\", \"days out\": 11}, {\"start_date\": \"1933-11-10\", \"end_date\": null, \"item_title\": \"The Orators\", \"item_authors\": \"Auden, W. H.\", \"item_year\": 1932.0, \"borrow_duration_days\": null, \"item\": \"The Orators by W. H. Auden (1932)\", \"dates\": \"1933-11-10 to -\", \"days out\": \"-\"}, {\"start_date\": \"1937-05-07\", \"end_date\": null, \"item_title\": \"New Writing\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"New Writing\", \"dates\": \"1937-05-07 to -\", \"days out\": \"-\"}, {\"start_date\": \"1937-05-07\", \"end_date\": null, \"item_title\": \"Something of Myself: For My Friends Known and Unknown\", \"item_authors\": \"Kipling, Rudyard\", \"item_year\": 1937.0, \"borrow_duration_days\": null, \"item\": \"Something of Myself: For My Friends Known and Unknown by Rudyard Kipling (1937)\", \"dates\": \"1937-05-07 to -\", \"days out\": \"-\"}, {\"start_date\": \"1937-05-07\", \"end_date\": null, \"item_title\": \"New Writing\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"New Writing\", \"dates\": \"1937-05-07 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-09-07\", \"end_date\": null, \"item_title\": \"Life and Death of a Spanish Town\", \"item_authors\": \"Paul, Elliot\", \"item_year\": 1937.0, \"borrow_duration_days\": null, \"item\": \"Life and Death of a Spanish Town by Elliot Paul (1937)\", \"dates\": \"1938-09-07 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-09-07\", \"end_date\": \"1938-09-10\", \"item_title\": \"The Dead Don't Care\", \"item_authors\": \"Latimer, Jonathan\", \"item_year\": 1938.0, \"borrow_duration_days\": 3.0, \"item\": \"The Dead Don't Care by Jonathan Latimer (1938)\", \"dates\": \"1938-09-07 to 1938-09-10\", \"days out\": 3}, {\"start_date\": \"1938-09-30\", \"end_date\": \"1938-10-26\", \"item_title\": \"Homage to Catalonia\", \"item_authors\": \"Orwell, George\", \"item_year\": 1938.0, \"borrow_duration_days\": 26.0, \"item\": \"Homage to Catalonia by George Orwell (1938)\", \"dates\": \"1938-09-30 to 1938-10-26\", \"days out\": 26}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}, {\"start_date\": \"1938-10-26\", \"end_date\": null, \"item_title\": \"Saturday Review of Literature\", \"item_authors\": null, \"item_year\": null, \"borrow_duration_days\": null, \"item\": \"Saturday Review of Literature\", \"dates\": \"1938-10-26 to -\", \"days out\": \"-\"}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.VConcatChart(...)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# generate a raincloud plot with a tooltip for hover interaction\n",
    "import altair as alt\n",
    "\n",
    "hemingway_raincloud = raincloud_plot(\n",
    "    hemingway_borrows, 'borrow_duration_days', 'Borrow duration in days',\n",
    "    tooltip=alt.Tooltip(['item', 'dates', 'days out']))\n",
    "hemingway_raincloud = hemingway_raincloud.properties(title='Distribution of borrow duration for Ernest Hemingway')\n",
    "hemingway_raincloud"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# save the chart as high res static image\n",
    "save_altair_chart(hemingway_raincloud, \"fig 12 - hemingway_borrow_duration_raincloud_plot.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# export to html for embedding interactive version\n",
    "hemingway_raincloud.save(\"hemingway_borrow_duration_raincloud_plot.html\")"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "provenance": [],
   "toc_visible": true
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
